<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<link rel="stylesheet"
	href="<c:url value="/resources/lib/bootstrap-3.3.5/css/bootstrap.min.css"/>" />
	<link href="/resources/lib/font-awesome-4.4.0/css/font-awesome.min.css"
	rel="stylesheet" type="text/css" />
	<link href="/resources/lib/font-awesome-4.4.0/css/font-awesome.min.css"
	rel="stylesheet" type="text/css" />
		
<link href="/resources/css/header.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet"href="<c:url value="/resources/css/common.css"/>" />
<link rel="stylesheet"
	href="<c:url value="/resources/css/task/taskFlow.css"/>" />
<script src="<c:url value="/resources/lib/jquery-2.1.4.min.js" />"
	type="text/javascript"></script>
<script
	src="<c:url value="/resources/lib/bootstrap-3.3.5/js/bootstrap.min.js" />"
	type="text/javascript"></script>
<script
	src="<c:url value="/resources/lib/angular-1.4.7/angular.min.js"/>"
	type="text/javascript">
	
</script>
<script src="<c:url value="/resources/js/task/taskFlow.js" />"
	type="text/javascript"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>task Flow</title>
</head>
<body ng-app="conversionTool">
<ng-include src="'/resources/viewPart/nav.html'" >
	
	</ng-include>
	<header>
	   <div class="head-line">
		<h3 class="head-title">Task Flow</h3>
		</div>
	</header>


	<section class="container" ng-controller="taskFlowCtrl">

		<form role="form" method="post" action="/task/addTask"
			ng-submit="checkFlowName()" class="form-horizontal text-center">
			<input name="id" ng-init="taskFlow.id='${ taskFlow.id}'"
				value="${taskFlow.id }" type="hidden" />
			<div ng-init="getTasksByTaskFlowId()"></div>


				<div class="form-group text-center form-line">
                   <div class="col-xs-4 text-right">
					<label>Task Flow Name</label>
				</div>
				<div class="col-xs-8">
					<input type="text" class="form-control" id="taskFlowName"
						name="taskFlowName"
						ng-init="taskFlow.taskFlowName='${ taskFlow.taskFlowName}'"
						ng-model="taskFlow.taskFlowName" />
				</div>
			</div>

             	<div class="form-group text-center form-line">
				<div class="col-xs-4 text-right">
					<label>Task Sequence</label>
				</div>
				<div class="col-xs-8"></div>
			</div>

			<div class="form-group text-center form-line">

				<div class="col-xs-4 text-right"></div>
				<div class="col-xs-8">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>Sequence</th>
								<th>Task Name</th>
								<th ng-show="'NEW'=='${taskFlow.status}'">delete</th>
								<th ng-show="'NEW'=='${taskFlow.status}'">view data</th>
								<th
									ng-show="''!='${taskFlow.status}'&&'NEW'!='${taskFlow.status}'">view
									log</th>
							</tr>
						</thead>
						<tbody>

							<tr ng-repeat="item in tasks">
								<td>{{$index + 1}}</td>
								<td>{{item.taskName}}</td>
								<th ng-show="'NEW'=='${taskFlow.status}'">
								
								<!--  <input type="button" value="delete" class="btn btn-default"
									ng-click="deleteTask(item.id )" />-->
									<button type="button"  class="btn btn-default btn-border"
									ng-click="deleteTask(item.id )" >
									<span><i class="glyphicon glyphicon-trash"></i></span>
									</button>
									
									</th>
								<th ng-show="'NEW'=='${taskFlow.status}'">
								
								<!--  <input type="button" value="view data" class="btn btn-default"
									ng-click="viewData(item.id )" />-->
									
									 <button type="button" class="btn btn-default btn-border"
									ng-click="viewData(item.id )" >
									  <span><i class="glyphicon glyphicon-edit"></i></span>
									</button>
									
									</th>
								<td
									ng-show="''!='${taskFlow.status}'&&'NEW'!='${taskFlow.status}'">
									
									<!-- 
									<input type="button" value="view log" class="btn btn-default"
									ng-click="viewLog(item.id )" /> -->
									
									<button type="button" class="btn btn-default btn-border"
									ng-click="viewLog(item.id )" >
									 <span><i class="glyphicon glyphicon-edit"></i></span>
									</button>
									
									
									
									
									</td>
							</tr>

						</tbody>
					</table>
				</div>
			</div>

			<div class="form-group text-center form-line"
				ng-show="'NEW'=='${taskFlow.status}'||'${taskFlow.status}'==''">
				<div class="col-xs-4 text-right"></div>
				<div class="col-xs-8 text-right">
					<input type="submit" value="Add Task" class="btn btn-primary two-btn" /> 
					<input type="button" value="Run" class="btn btn-primary two-btn" ng-click="run()" />
				</div>
			</div>
	<div class="form-group text-center form-line">
	           <div class="col-xs-4 text-right"></div>
	   <div class="col-xs-8 text-right">
			<div ng-show="''!='${taskFlow.status}'&&'NEW'!='${taskFlow.status}'">
				<input type="button" value="Back" class="btn btn-primary"
					ng-click="back()" />
			</div>
			</div>
		</div>
		
			
			<div class="form-group text-center form-line">
				<div class="control-group error">
					<span class="help-inline">{{msg}}</span>
				</div>
			</div>

		</form>
	</section>

</body>
</html>